package cn.mcartoon.serviceImpl;
import cn.mcartoon.mapper.MmRechargeOrderMapper;
import cn.mcartoon.pojo.MmRechargeOrder;
import cn.mcartoon.service.MmRechargeOrderService;
import cn.mcartoon.dto.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;
@Service
public class MmRechargeOrderServiceImpl implements MmRechargeOrderService {

    @Autowired
    private MmRechargeOrderMapper mmRechargeOrderMapper;

    public MmRechargeOrder getMmRechargeOrderById(Long id){
        return mmRechargeOrderMapper.getMmRechargeOrderById(id);
    }

    public List<MmRechargeOrder>	getMmRechargeOrderListByMap(Map<String,Object> param){
        return mmRechargeOrderMapper.getMmRechargeOrderListByMap(param);
    }

    public Integer getMmRechargeOrderCountByMap(Map<String,Object> param){
        return mmRechargeOrderMapper.getMmRechargeOrderCountByMap(param);
    }

    public Integer insertMmRechargeOrder(MmRechargeOrder mmRechargeOrder){
            return mmRechargeOrderMapper.insertMmRechargeOrder(mmRechargeOrder);
    }

    public Integer updateMmRechargeOrder(MmRechargeOrder mmRechargeOrder){
        return mmRechargeOrderMapper.updateMmRechargeOrder(mmRechargeOrder);
    }

    public Integer deleteMmRechargeOrderById(Long id){
        return mmRechargeOrderMapper.deleteMmRechargeOrderById(id);
    }

    public Integer batchDeleteMmRechargeOrder(String ids){
        Map<String,List<String>> param=new HashMap<String,List<String>>();
        String[] paramArrays=ids.split(",");
        List<String> idList=new ArrayList<String>();
            for (String temp:paramArrays){
                idList.add(temp);
            }
        param.put("ids",idList);
        return mmRechargeOrderMapper.batchDeleteMmRechargeOrder(param);
    }

    public Page<MmRechargeOrder> queryMmRechargeOrderPageByMap(Map<String,Object> param,Integer pageNo,Integer pageSize){
        Integer total = mmRechargeOrderMapper.getMmRechargeOrderCountByMap(param);
        Page page = new Page(pageNo, pageSize, total);
        param.put("beginPos", page.getBeginPos());
        param.put("pageSize", page.getPageSize());
        List<MmRechargeOrder> mmRechargeOrderList = mmRechargeOrderMapper.getMmRechargeOrderListByMap(param);
        page.setList(mmRechargeOrderList);
        return page;
     }


}
